package com.yc2.Test01;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName test01
 * @since: 2023/7/25 18:34
 * @auth: kirito
 * @description:
 **/
public class test01 {
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i <5 ; i++) {
            Task t = new Task();
            Thread thread = new Thread(t);
            thread.start();
            Thread.sleep(1000);
        }
    }
    static class Task implements Runnable {
        @Override
        public void run() {
            while (true){
                Date d = new Date();
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String fileName = sdf.format(d);
                System.out.println(Thread.currentThread().getName()+"  "+fileName);
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        }
    }

}

